package com.skyworth.web.order.service;

import com.skyworth.web.order.domain.OrderModel;
import com.skyworth.web.order.domain.ParentOrderModel;

import java.util.List;
import java.util.Map;

/**
 * Created by lxs on 2016/6/23.
 */
public interface NewOrderService {
    /**
     * 已确认订单
     */
    int ORDER_CONFIRMED = 0;
    /**
     * wecat端支付订单
     */
    int ORDER_WECHAT_PAYED = 1;
    /**
     * 未确认订单
     */
    int ORDER_UNCONFIRMED = 2;
    /**
     * 购物车信息
     */
    int ORDER_CART = 3;

    /**
     * 扫描服务员端生成的收款码支付
     */
    int ORDER_USER_SCAN_QR_PAYED = 4;

    /**
     * 用户线下付款
     */
    int ORDER_USER_OFFLINE_PAYED = 5;

    /**
     * 服务员拒绝订单
     */
    int ORDER_WAITER_REFUSE = 6;

    /**
     * 取消保存的购物车
     */
    int ORDER_CART_CANCEL = 7;

    /**
     * 用户已删除的订单
     */
    int ORDER_DELETE = 8;

    /**
     * 服务员已删除的订单
     */
    int WAITER_ORDER_DELETE = 9;

    /**
     * 添加或者修改一个订单
     * @param orderModel
     * @return
     */
    OrderModel saveOrUpdate(ParentOrderModel parentOrderModel,OrderModel orderModel, List<Map<String, Object>> list) throws  Exception;

    /**
     * 获取服务器的购物车订单
     * @param userId
     * @return
     */
    OrderModel getOrderCart(String userId);

    /**
     * 获取台桌的父订单
     * @param tableId
     * @return
     */
    ParentOrderModel getLastByTableId(String userId);

    /**
     * 获取所有子订单的总价格
     * @param tableId
     * @return
     */
    float getOrderPrice(String userId);

    /**
     * 获取父订单信息
     * @param id
     * @return
     */
    ParentOrderModel getParentOrderById(long id);

    /**
     * 结账后更新订单和台桌状态
     * @param userId
     * @param tableId
     */
    public void updateOrderState(String userId,long tableId,String subOrderIds[]);

    /**
     * 获取当前台桌没支付的订单
     * @param userId
     * @return
     */
    Map<String,Object> getCurrentTableNoPayOrder(String userId);

    /**
     * 获取用户支付过的订单
     * @param userId
     * @param page
     * @param pagesize
     * @return
     */
    Map<String,Object> getUserHistoryOrder(String userId,int page,int pagesize);

    /**
     * 获取服务员端未支付的订单
     * @param storeId
     * @param page
     * @param pagesize
     * @return
     */
    Map<String,Object> getStoreNopayOrder(long storeId,int page,int pagesize);

    /**
     * 服务员端待确认订单
     * @param storeId
     * @param page
     * @param pagesize
     * @return
     */
    Map<String,Object> getStoreConfirmOrder(long storeId,int page,int pagesize);

    /**
     * 根据子订单id获取详情
     * @param subOrderId
     * @return
     */
    Map<String,Object> getSubOrderById(long subOrderId);


    Map<String,Object> getParentOrderDetail(long parentOrderId);

    Map<String,Object> getParentPayOrderDetail(long parentOrderId);

    Map<String,Object> getParentNoPayOrderDetail(long parentOrderId);

    /**
     * 服务员拒绝订单
     * @param id
     */
    void refuseOrder(Long id);

    /**
     * 服务员同意订单
     * @param id
     */
    OrderModel acceptOrder(Long id);

    /**
     * 服务员退菜
     * @param itemId
     * @return
     */
    OrderModel removeMenuItem(Long itemId);

    /**
     * 用户删除已支付订单
     * @param parentOrderId
     */
    void deleteOrder(long parentOrderId);

    /**
     * 服务员删除订单
     * @param parentOrderId
     */
    void waiterDeleteOrder(long parentOrderId);


    /**
     * 线下结账
     * @param userId
     */
    public void offlinePay(long parentOrderId,String userId);

    /**
     * 查看子订单状态
     * @param subOrderId
     * @return
     */
    public OrderModel qrySubOrderState(long subOrderId);

    /**
     * 获取订单下单和更新通知
     * @param lastUpdateDate
     * @return
     */
    public Map<String,Object> getOrderNotifyList(long storeId,String lastUpdateDate);

    /**
     * 微信获取未支付订单
     * @param userId
     * @return
     */
    public List<Map<String,Object>> getWechatTableConfirmOrder(String userId);

    public List<Long> getCurrentTableNoPaySubOrderId(String userId);

    public Map<String,Object> getTodayZbData(long storeId,List<Integer> fromsList,List<Integer> stateList);

    public List<Map<String,Object>> getTodayTopMenuData(long storeId,List<Integer> fromsList,List<Integer> stateList);

    public List<Map<String,Object>> getTodayOrderListData(long storeId,List<Integer> fromsList,List<Integer> stateList);

    Map<String,Object> getTableUpdateList(long storeId, String updateDate);

    Map<String,Object> getCurrentUpdateDate();

}
